Array.prototype.myMap = function (fn) {
  const result = []
  const arr = this
  arr.reduce((pre, cur, i) => {
    result[i] = fn.call(this, cur, i, arr)
  }, 0)
  return result
}
let arr = [1, 2, 3]
let a = arr.myMap((item, index, array) => {
  if (index == 1) {
    return item * 2
  } else {
    return item
  }
})
console.log(a);

[].map((item, index, arr) => {})
Array.prototype._map = function (fn) {
  const context = this
  return context.reduce((pre, cur, index, arr) => [...pre, fn(cur, index, arr)], [])
}